package me.yushuai.wukong.base.entity;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import me.yushuai.wukong.common.domain.AbstractAudit;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * 工作区
 *
 * @author zhoushuai@189.cn
 * @TableName BAS_WORKING_AREA
 */
@Entity
@Getter
@Setter
@ToString
@Table(name = "BAS_WORKING_AREA")
public class WorkingArea extends AbstractAudit implements Serializable {
    /**
     * 工作区域Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    private Long id;

    /**
     * 工作区域编码
     */
    @Column(name = "BIZ_ID", updatable = false, nullable = false)
    private String bizId;

    /**
     * 工作区名
     */
    @Column(name = "WORKING_AREA_NAME")
    private String workingAreaName;

    /**
     * 上架过度库位
     */
    @Column(name = "PUT_TO_LOCATION_ID")
    private Long putToLocationId;

    /**
     * 下架过度库位
     */
    @Column(name = "PICK_TO_LOCATION_ID")
    private Long pickToLocationId;

    /**
     * 关联仓库编号
     */
    @Column(name = "WAREHOUSE_ID", nullable = false, updatable = false)
    private Long warehouseId;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        WorkingArea that = (WorkingArea) o;
        return getId().equals(that.getId()) && Objects.equals(getBizId(), that.getBizId()) && Objects.equals(getWorkingAreaName(), that.getWorkingAreaName()) && Objects.equals(getPutToLocationId(), that.getPutToLocationId()) && Objects.equals(getPickToLocationId(), that.getPickToLocationId()) && Objects.equals(getWarehouseId(), that.getWarehouseId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), getId(), getBizId(), getWorkingAreaName(), getPutToLocationId(), getPickToLocationId(), getWarehouseId());
    }
}